package com.glsc.ngateway.common.base.domain.mysql.gateway.platform.flow;

import com.glsc.ngateway.common.base.domain.mysql.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Index;
import javax.persistence.Table;


/**
 * @author xuchang
 */
@EqualsAndHashCode(callSuper = true)
@Data
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
@Entity
@Where(clause = "deleted = 0")
@SQLDelete(sql = "update t_gw_it_flow_config set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@SQLDeleteAll(sql = "update t_gw_it_flow_config set deleted = UNIX_TIMESTAMP(NOW()) where id=?")
@Table(name = "t_gw_it_flow_config", indexes = {@Index(name = "IDX_PRO_TASK", columnList = "process_def_key, task_def_key, config_type, deleted")})
public class FlowConfig extends BaseEntity {

    private static final long serialVersionUID = -4881971079582370963L;

    @Column(name = "process_def_key", columnDefinition = "varchar(128) not null comment '流程定义key'")
    private String processDefKey;

    @Column(name = "task_def_key", columnDefinition = "varchar(128) comment '节点定义key'")
    private String taskDefKey;

    @Column(name = "config_type", columnDefinition = "varchar(32) not null comment '配置类别'")
    private String configType;

    @Column(name = "value_type", columnDefinition = "varchar(32) comment '值类型'")
    private String valueType;

    @Column(name = "value", columnDefinition = "varchar(1024) not null comment '值'")
    private String value;

    @Column(name = "task_assignee_group_name", columnDefinition = "varchar(1024) comment '审批人Group命名'")
    private String taskAssigneeGroupName;

    @Column(name = "conditional_variable_key_name", columnDefinition = "varchar(1024) comment '节点变量key命名'")
    private String conditionalVariableKeyName;

    @Column(name = "remark", columnDefinition = "varchar(256) comment '备注'")
    private String remark;

}
